icon-helper: don't warn out when the icon size is GTK_ICON_SIZE_INVALID
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 30 Nov 2011 23:32:01 +0000 (18:32 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 30 Nov 2011 23:32:01 +0000 (18:32 -0500)
We can call ensure_icon_size() for an empty image; don't warn out in
that case, but just return a zero width.

gtk/gtkiconhelper.c

index 46724f9197b79f0342c719c93a6e3c99afdb735e..063b7a850556b7f2612d3e6e760a8230eb28956a 100644 (file)
@@ -128,8 +128,15 @@ ensure_icon_size (GtkIconHelper *self,
                                               self->priv->icon_size,
                                               &width, &height))
     {
-      g_warning ("Invalid icon size %d\n", self->priv->icon_size);
-      width = height = 24;
+      if (self->priv->icon_size == GTK_ICON_SIZE_INVALID)
+        {
+          width = height = 0;
+        }
+      else
+        {
+          g_warning ("Invalid icon size %d\n", self->priv->icon_size);
+          width = height = 24;
+        }
     }
 
   *width_out = width;